package com.wthink.hzgj.data.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.wthink.hzgj.data.domain.Station

@Dao
interface StationDao {

    @Query("SELECT * FROM Station where line=:line and upDir=:upDir")
    suspend fun listByLineDir(line: String, upDir: Boolean): List<Station>

    @Query("DELETE FROM Station where line=:line")
    suspend fun delByLine(line: String)

    @Query("DELETE FROM Station")
    suspend fun delete()

    @Query("SELECT * FROM Station where station=:stationId")
    suspend fun listById(stationId: String): List<Station>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun save(data: List<Station>)

    @Query("SELECT * FROM Station where station=:stationName")
    suspend fun listByName(stationName: String): List<Station>


}